package com.isoft.argi.services;

import com.isoft.argi.dao.BoardDao;
import com.isoft.argi.pojo.BoardNum;
import com.isoft.argi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Connection;
import java.sql.ResultSet;


import java.sql.*;
import java.util.List;

@Service
@Transactional
public class BoardService {

	@Autowired
	BoardDao boardDao ;

	public BoardNum getLastData() {
		return boardDao.getLastData() ;
	}

	public List<Double> getIntervalData(String sensorName ,String interval, Integer rowNum) {
		if(StringUtil.isEmpty(sensorName)) {
			return null ;
		}
		if(rowNum == null || rowNum < 1) {
			return null ;
		}
		return boardDao.getIntervalData(sensorName ,Integer.parseInt(interval), rowNum) ;
	}

}
